/************************************************************************
                        DataContainerLogic.h.cpp - Copyright asaf

**************************************************************************/

#include "DataContainerLogic.h"

// Constructors/Destructors
//  


DataContainerLogic::~DataContainerLogic ( ) {;}

//  
// Methods
//  


auto_ptr<Reply> DataContainerLogic::executeRequest (const Request &request) {
	
	auto_ptr<Reply> r;
	switch(request.getRequestType())
	{
	case LOGIN:
		r=data.checkLogin(request);
		break;
	case LOGOUT:
		r=data.personLogout(request);
		break;
	case ADD_PERSON:
		r=data.addNewPerson(request);
		break;
	case ADD_COURSE:
		r=data.addNewCourse(request);
		break;
	case ADD_COURSE_PREREQUISITE:
		r=data.addPreRequisitCourse(request);
		break;
	case DELETE_PERSON:
		r=data.deletePerson(request);
		break;
	case DELETE_COURSE:
		r=data.deleteCourse (request);
		break;
	case EDIT_PERSON:
		r=data.editPerson (request);
		break;
	case REGISTER_STUDENT_COURSE:
		r=data.registerStudentCourse (request);
		break;
	case ASSIGN_COURSE_LECTURER:
		r=data.assignCourseLecturerTime (request);
		break;
	case GET_ALL_COURSE:
		r=data.getAllCourses ();
		break;
	case SET_STUDENT_COURSE_COMPLETED:
		r=data.setStudentCourse_Completed(request);
		break;
	case GET_COURSE_DATA:
		r=data.getCourseData (request);
		break;
	case GET_PERSON_DATA:
		r=data.getPersonData (request);
		break;
	case GET_COURSES_FOR_SEMESTER:
		r=data.getCoursesForSemester (request);
		break;
	default:
		r=auto_ptr<Reply>(new Reply(UNKNOWEN_REQUEST));
		break;
	}
	return r;

}


